package com.zd.service.order.impl;

import com.zd.domain.Order;
import com.zd.mapper.OrderMapper;
import com.zd.service.order.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;
    @Override
    public List<Order> findOrdersByUserId(int userId) {
        return orderMapper.findOrdersByUserId(userId);
    }

    @Override
    public int updateOrderState(int orderNo) {

        return orderMapper.updateOrderState(orderNo);

    }

    @Override
    public Order findOrderByOrderNo(int orderNo) {
        return orderMapper.findOrderByOrderNo(orderNo);
    }

    @Override
    public int saveOrder(Order order) {
        return orderMapper.saveOrder(order);
    }

    @Override
    public Order findPayState(int userId, int goodId) {
        return orderMapper.findPayState(userId, goodId);
    }

    @Override
    public int updateOrderNoPay(int orderNo) {
        return orderMapper.updateOrderNoPay(orderNo);
    }
}
